﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="clients.aspx.cs" Inherits="clients" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <link href="css/YahooGridView.css" rel="stylesheet" type="text/css" />
    <script language="javascript">
        function MyDelay() { setTimeout("FocusFunction()", 1000); }
        function FocusFunction() { document.getElementById("ctl00_ContentPlaceHolder1_tbSearch").focus(); }
        MyDelay();    
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div class="div-box" style="width:500px; text-align:center; margin-left:auto; margin-right:auto;">
        <asp:TextBox ID="tbSearch" runat="server" Width="300px" />
        <ajax:TextBoxWatermarkExtender ID="weSearch" runat="server" TargetControlID="tbSearch" WatermarkText="search by name or number" />
        <asp:Button ID="btSearch" runat="server" Text="Search" OnClick="btSearch_Click" />
        <asp:Button ID="btClearSearch" runat="server" Text="Clear" OnClick="btClearSearch_Click" />                
    </div>
    <div class="div-box" style="width:500px; margin-left:auto; margin-right:auto">
        <prt:showfootergridview ID="gvClient" runat="server" DataSourceID="dsClient" AutoGenerateColumns="False" DataKeyNames="ClientID" 
            ShowFooter="True" AllowPaging="True" PageSize="10" CssClass="GridViewStyle" ShowHeaderWhenEmpty="true" PagerSettings-Mode="NumericFirstLast" Width="100%" OnDataBinding="gvClient_DataBinding">
            <HeaderStyle CssClass="HeaderStyle" />
            <PagerStyle CssClass="PagerStyle" />
            <RowStyle CssClass="RowStyle" />
            <Columns>
                <asp:TemplateField HeaderText="Name" SortExpression="Name">
                    <ItemTemplate>
                        <asp:HyperLink ID="lbName" runat="server" Text='<%# Eval("Name") %>' NavigateUrl='<%# "~/client.aspx?ID=" + Eval("ClientID") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Number" SortExpression="Number" ItemStyle-HorizontalAlign="Center" FooterStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:Label ID="lbNumber" runat="server" Text='<%# Eval("Number") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Ext" SortExpression="Extension" ItemStyle-HorizontalAlign="Center" FooterStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:Label ID="lbExtension" runat="server" Text='<%# Eval("Extension") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Type" SortExpression="ClientTypeID" ItemStyle-HorizontalAlign="Center" FooterStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:Label ID="lbClientType" runat="server" Text='<%# Eval("ClientType.Description") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Website" SortExpression="website">
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Eval("website") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ShowHeader="false" ItemStyle-HorizontalAlign="Center" Visible="false">
                    <ItemTemplate>
                        <asp:HyperLink ID="btEditClient" runat="server" ImageUrl="~/images/edit.gif" NavigateUrl='<%# "~/editclients.aspx?ID=" + Eval("ClientID") %>' />
                    </ItemTemplate>
                </asp:TemplateField>                
            </Columns>
        </prt:showfootergridview>
    </div>
    <asp:LinqDataSource ID="dsClient" runat="server" ContextTypeName="AnsweringServiceDataContext" TableName="Clients" />    
</asp:Content>

